import { bootstrap, provide, Component, View, FORM_PROVIDERS } from 'angular2/angular2';
import { Location, RouteConfig, RouterLink, Router, ROUTER_PROVIDERS, APP_BASE_HREF } from 'angular2/router';
import { HTTP_PROVIDERS } from 'angular2/http';

import { LoggedInRouterOutlet } from '/resources/ts/loggedInOutlet.ts';
import { Login } from '/resources/ts/login.ts';
import { Main } from '/resources/ts/main.ts';

@Component({
  selector: 'app'
})
@View({
  template: `
    <!-- We use the new outlet in our HTML template -->
    <loggedin-router-outlet></loggedin-router-outlet>
  `,
   // Here we include the new RouterOutlet directive we'll create
  directives: [LoggedInRouterOutlet]
})
@RouteConfig([
  // { path: '/',       redirectTo: '/home' },
  { path: '/login',  as: 'Login',  component: Login },
  // { path: '/home',   as: 'Home',   component: Home }
  { path: '/',   as: 'Main',   component: Main }
])
class App {

  constructor(public router: Router) {
  }

}

bootstrap(App,
  [
    FORM_PROVIDERS,
    ROUTER_PROVIDERS,
    HTTP_PROVIDERS,
    provide(APP_BASE_HREF, { useValue: '/' }
  ])
  .catch(err => console.error(err));
